﻿@model LAPI.Data.Model.DeportePista
           
<div class="row">
    <h2>Administración de Actividades por Pista</h2>
    <h3>Crea, Elimina o Actualiza los deportes y/o actividades de tus pistas de LAPI...</h3>
</div>
<hr />

<div class="row">
<div id="msg" class="span5"></div> 
</div>

<div class="marketing">
    <div class="row">
        @using (Ajax.BeginForm(
            actionName: "Crear",
            controllerName: "DeportesPista",
            routeValues: null,
            ajaxOptions: new AjaxOptions { HttpMethod = "Post" /*, InsertionMode = System.Web.Mvc.Ajax.InsertionMode.InsertBefore, UpdateTargetId = "alerts"*/, OnFailure = "PostFailure", OnSuccess = "PostSuccess", OnComplete = "PostOnComplete" },
            htmlAttributes: new Dictionary<string, object> { { "class", "form-horizontal" } }
        ))
        {          
            <!-- Campos ocultos -->
            @LAPI.Web.Helpers.TextBoxExtension.TextBoxFor(this.Html, m => m.idPista, new Dictionary<string, object> { { "style", "display:none;" }, { "value", Model.idPista } }) 
            @LAPI.Web.Helpers.TextBoxExtension.TextBoxFor(this.Html, m => m.luz, new Dictionary<string, object> { { "style", "display:none;" }, { "value", Model.luz } }) 
            
             <div class="control-group">
                @LAPI.Web.Helpers.LabelExtensions.LabelFor(this.Html, m => m.deporte, new Dictionary<string, object> { { "class", "control-label" } })
                <div class="controls">                   
                    @Html.DropDownList(name: "idDeporte", selectList: new System.Collections.Generic.List<SelectListItem>(), htmlAttributes: new Dictionary<string, object> { { "class", "span3" } })
                </div>
            </div>
            
            <div class="control-group">
                @LAPI.Web.Helpers.LabelExtensions.LabelFor(this.Html, m => m.precio, new Dictionary<string, object> { { "class", "control-label" } })
                <div class="controls">
                    @LAPI.Web.Helpers.TextBoxExtension.TextBoxFor(this.Html, m => m.precio, new Dictionary<string, object> { { "class", "span3" }, { "maxlength", "5" }, { "placeholder", "precio por hora de la pista... 0,5(ej)" } })                   
                </div>
            </div>
            
            <div class="control-group">
                @LAPI.Web.Helpers.LabelExtensions.LabelFor(this.Html, m => m.suplementoLuz, new Dictionary<string, object> { { "class", "control-label" } })
                <div class="controls">
                    @LAPI.Web.Helpers.TextBoxExtension.TextBoxFor(this.Html, m => m.suplementoLuz, new Dictionary<string, object> { { "class", "span3" }, { "maxlength", "5" }, { "placeholder", "suplemento por hora luz artificial..." }, { @Model.luz ? "value" : "readonly", "" } })                   
                </div>
            </div>                                     

            <div class="control-group">
                <div class="controls">
                    <button type="submit" class="btn btn-success">
                        <i class="icon-ok"></i>
                        Crear</button>
                    <a class="btn btn-danger" href="@Url.Action(actionName: "Gestion", controllerName: "DeportesPista", routeValues: new { id = @Model.idPista } )">
                        <i class="icon-remove"></i>
                        Cancelar
                    </a> 
                </div> 
            </div>
        }                        
    </div>
</div>

@section Script {   
<script type="text/javascript">
    document.forms[0].idDeporte.focus();

    var dropdownElement = $('#idDeporte');
    var url = '/Deporte/getDeportes';
    var data = {};
    var vaciar = true;
    fillDropDownList(dropdownElement, url, data, vaciar );
   
</script>
}
